/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Army;

import GameObject.Sprite;
import java.awt.Point;
import java.awt.image.BufferedImage;

/**
 *
 * @author Huy
 */
public class Stab extends Bullet {

	public static BufferedImage SPRITE;
	public Stab(int team, Point pos, double rotation, double d,int damage) {
		int y = -(int) (d * Math.cos(rotation));
		int x = (int) (d * Math.sin(rotation));
		this.team = team;
		sprite = new Sprite(SPRITE, 1, 5, pos.x + x, pos.y + y);
		isHited = false;
		sprite.setInnerPoint(new Point(10, 2));
		sprite.setRotation(Math.random() * pi * 2);
		this.speed = 0;
		this.range = 0;
		this.damage = damage;
		size = 2;
		liveTime = 5;

	}

	@Override
	public void update() {
		super.update();
		sprite.nextFrame();
		if (isHited) {
			liveTime--;
			if (liveTime < 0) {
				isDetroyed = true;
			}
			return;
		}

		isHited = true;

	}
}
